<template>
  <div class="index">
    <el-container>
      <el-header
        ><el-button type="info" @click="logout">退出</el-button></el-header
      >
      <el-container>
        <el-aside width="200px">侧边栏</el-aside>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: "index",
  data() {
    return {};
  },
  methods: {
    logout() {
      this.$confirm("确认退出吗", {
        confirmButtonText: "确认",
        cancelButtonText: "取消",
        type: "success"
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "退出成功"
          });
          window.sessionStorage.clear();
          this.$router.push("/login");
        })
        .catch(() => {
          this.$message({
            type: "success",
            message: "取消退出"
          });
        });
    }
  }
};
</script>

<style lang="scss" scoped>
.index {
  width: 100%;
  height: 100%;
  display: flex;
}
.el-header,
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
  position: relative;
  .el-button {
    position: absolute;
    right: 20px;
    top: 10px;
  }
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  line-height: 200px;
}

.el-main {
  background-color: #e9eef3;
  color: #333;
  text-align: center;
  line-height: 160px;
}

body > .el-container {
  margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}
</style>